/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufscar.compiladores.ast;

import java.util.ArrayList;
import java.util.Collection;

/**
 *
 * @author takeshi
 */
public class ProcedureDecList {

    private Collection<Subroutine> procedureDecList;

    public ProcedureDecList(Collection<Subroutine> procedureDecList) {
        this.procedureDecList = procedureDecList;
    }
    
    public ProcedureDecList() {
        this.procedureDecList = new ArrayList<Subroutine>();
    }

    public void genC(PW pw) {
        for (Subroutine subroutine : procedureDecList) {
            if (subroutine instanceof Procedure) {
                ((Procedure)subroutine).genC(pw);
            }else
                ((Function)subroutine).genC(pw);
        }
    }

    public void add(Subroutine proc) {
        procedureDecList.add(proc);
    }
}
